function tijao() { 
	var listsize = document.getElementById('listsize').value;
	for(var i=0;i<listsize;i++)
	{
		if(document.getElementById('ch_id'+i).checked)
		{
			var  ch_id = document.getElementById('ch_id'+i).value; 
		  if(ch_id=="")
		  {
		  	alert("请选择栏目 ");
		  }else{
		   	document.getElementById('backMessage').innerHTML = '<img src="/program/admin/images/wait.gif"/>正在更新，请稍等...';
			 	$.ajax({
				   type: 'POST',
				   url: 'createChannelHtml.jsp',
				   data: 'ch_id='+ch_id,
				   success: function(msg){			 
				   	 	document.getElementById('backMessage').innerHTML=msg;
					 }
				});					
		  }  
		} 
	}
}


function updateListModel() { 
	 var  list_model = document.getElementById('list_model').value; 
  if(list_model=="")
  {
  	alert("请选择列表实体 ");
  }
else{
   	document.getElementById('listModelMessage').innerHTML = '<img src="/program/admin/images/wait.gif"/>正在更新，请稍等...';
	 	$.ajax({
		   type: 'POST',
		   url: 'updateListModel.jsp',
		   data: 'list_model='+list_model,
		   success: function(msg){
		   	 	document.getElementById('listModelMessage').innerHTML=msg;
			 }
		}); 

  }   
}



function updateContent() { 
	 var  ch_id = document.getElementById('ch_id').value; 
	 var start = document.getElementById('start').value; 
	 var row = document.getElementById('row').value; 
  if(ch_id=="")
  {
  	alert("请选择栏目 ");
  }
else{
   	document.getElementById('backMessage').innerHTML = '<img src="/program/admin/images/wait.gif"/>正在更新，请稍等...';
	 	$.ajax({
		   type: 'POST',
		   url: 'createContentHtml.jsp',
		   data: 'ch_id='+ch_id+'&start='+start+'&row='+row,
		   success: function(msg){
		   	 	document.getElementById('backMessage').innerHTML=msg;
			 }
		}); 

  }   
}

function updateIndex(index_temp,save_dir,default_page){
	 var  selects="";
    
		if(index_temp==""||save_dir==""||default_page==""){
			alert("请填写完整信息");
			return false;
		}
		var start=save_dir.indexOf("/");
		var end=save_dir.substring(save_dir.length-1,save_dir.length);
		if(start!=0||end!="/"){
			alert("请输入正确的格式如：/或/index/");
			return false;
		}
		
		var str=default_page.substring(default_page.indexOf(".")+1,default_page.length);
		if(str!="html"&&str!="htm"){
			alert("您上传的格式不被支持");
			return false;
		}
		
 		document.getElementById('backMessage').innerHTML = '<img src="/program/admin/images/wait.gif"/>正在更新，请稍等...';
		$.ajax({
		   type: 'POST',
		   url: 'create_index.jsp',
		   data: 'index_temp='+index_temp+'&save_dir='+save_dir+'&default_page='+default_page,
		   success: function(msg){
 					document.getElementById('backMessage').innerHTML = msg;
			 }
		}); 
}


function getFullPath(obj) 
{ 
	if(obj) 
	{ 
		//ie 
		if (window.navigator.userAgent.indexOf("MSIE")>=1) 
		{ 
			obj.select(); 
			return document.selection.createRange().text; 
		} 
		//firefox 
		else if(window.navigator.userAgent.indexOf("Firefox")>=1) 
		{ 
			if(obj.files) 
			{ 
				return obj.files.item(0).getAsDataURL(); 
			} 
			return obj.value; 
		} 
		return obj.value; 
	} 
} 



function choiceFile(){
	var gURL = "/program/admin/updateHtml/alter_index.jsp?height=400&width=750&file_path=";
	TB_show("文件选择页",gURL,true);
}

function setIndexTemp(val){
	if(val==""){
		alert("模板不能为空");
		return false;
	}
	document.location.href="/program/admin/updateHtml/update_index.jsp?index_temp="+val;
	TB_remove();
}

